package cloning.bl.chapt04;

import java.util.Vector;

public class Student implements Cloneable {

	private int id = 71;
	private Vector mark = new Vector();

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Vector getMark() {
		return mark;
	}

	public void setMark(Vector mark) {
		this.mark = mark;
	}

	// // shallow cloning
	// public Object clone()
	// {
	// try {
	// return super.clone();
	// } catch (CloneNotSupportedException e) {
	// throw new AssertionError("impossible!");
	// }
	//
	// }

	// deep cloning
	@SuppressWarnings("rawtypes")
	public Object clone() {
		try {
			Student copy = (Student) super.clone();
			copy.mark = (Vector) mark.clone();
			return copy;
		} catch (CloneNotSupportedException e) {
			throw new AssertionError("impossible!");
		}

	}

}
